package com.assets.room.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.assets.room.entity.Receives;

import java.util.List;

@Dao
public interface ReceivesDao {

    @Insert
    void insertReceive(Receives receives);

    @Insert
    void insertReceive(List<Receives> receives);

    @Query("DELETE FROM t_asset_receives")
    void deleteAllData();

    @Query("SELECT * FROM t_asset_receives")
    List<Receives> getAllReceives();

    @Query("SELECT reapply_date FROM t_asset_receives WHERE receives_id = :receives_id")
    String getReapplyDate(String receives_id);

    @Query("SELECT place FROM t_asset_receives WHERE receives_id = :receives_id")
    String getPlace(String receives_id);

    @Query("SELECT receives_user FROM t_asset_receives WHERE receives_id = :receives_id")
    String getUser(String receives_id);

    @Query("SELECT receives_dept FROM t_asset_receives WHERE receives_id = :receives_id")
    String getDept(String receives_id);

    @Query("SELECT status FROM t_asset_receives WHERE receives_id = :receives_id")
    String getStatus(String receives_id);

    @Query("SELECT * FROM t_asset_receives WHERE is_flag = :is_flag")
    List<Receives> getAllReceivesByStatus(String is_flag);

    @Query("SELECT * FROM t_asset_receives WHERE receives_id = :receives_id")
    Receives getAllReceives(String receives_id);

    @Query("UPDATE t_asset_receives SET status = :status WHERE receives_id = :receives_id")
    void updateStatus(String status, String receives_id);

    @Query("UPDATE t_asset_receives SET status = :status, is_flag = :is_flag WHERE receives_id = :receives_id")
    void updateStatus1(String status, String is_flag, String receives_id);

    @Query("UPDATE t_asset_receives SET receives_date = :receives_date, is_flag = :is_flag WHERE receives_id = :receives_id")
    void updateStatus2(String receives_date, String is_flag, String receives_id);


    @Query("UPDATE t_asset_receives SET isreturn = :isreturn, is_flag = :is_flag WHERE receives_id = :receives_id")
    void updateStatus(String isreturn,String is_flag, String receives_id);

}
